import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { HitokotoVo } from "../vo/hitokoto-vo";

@Injectable({
  providedIn: 'root',
})
export class HitokotoService {

  constructor(private http: HttpClient){
  }

  getHitokoto(types: string[]):Observable<HitokotoVo>{
    var cs = "";
    for(var i = 0; i < types.length; i++){
      cs+="&c="+types[i];
    }
    return this.http.get<HitokotoVo>("https://v1.hitokoto.cn/?max_length=30"+cs);
  }


}
